package com.learn.springlearn.entity.channel;

import lombok.Getter;

import java.util.Objects;

/**
 * @author sunmingping
 */
@Getter
public enum ProvinceMappingEnum {


    /**
     * 易鑫，中瑞省份对应码值
     */
    SICHUAN("510000","51","四川省"),

    YUNNAN("530000","53","云南省"),

    AOMENG("820000","68","澳门"),

    GANSHU("620000","62","甘肃省"),

    HUNAN("430000","43","湖南省"),

    HENAN("410000","41","河南省"),

    HAINAN("460000","46","海南省"),

    HEILONGJIANG("230000","23","黑龙江省"),

    JIANGXI("360000","36","江西省"),

    TAIWAN("710000","67","台湾"),

    SHANDONG("370000","37","山东省"),

    JIANGSU("320000","32","江苏省"),

    GUANGDONG("440000","44","广东省"),

    XIZHANG("540000","54","西藏自治区"),

    LIAONING("210000","21","辽宁省"),

    BEIJING("110000","11","北京市"),

    GUANGXI("450000","45","广西壮族自治区"),

    SHANGHAI("310000","31","上海市"),

    HUBEI("420000","42","湖北省"),

    JILING("220000","22","吉林省"),

    ANHUI("340000","34","安徽省"),

    QINGHAI("630000","63","青海省"),

    GUIZHOU("520000","52","贵州省"),

    XIANGGANG("810000","66","香港"),

    NEIMENG("150000","15","内蒙古自治区"),

    CHONGQING("500000","50","重庆市"),

    NINGXIA("640000","64","宁夏回族自治区"),

    ZHEJIANG("330000","33","浙江省"),

    HEBEI("130000","13","河北省"),

    SHANXI("610000","61","陕西省"),

    XINJIANG("650000","65","新疆维吾尔自治区"),

    FUJIANG("350000","35","福建省"),

    TIANJIN("120000","12","天津市"),

    JIN("140000","14","山西省")

        ;

    private final String yxProvinceCode;

    private final String lunzProvinceCode;

    private final String provinceName;

    ProvinceMappingEnum(String yxProvinceCode, String lunzProvinceCode, String provinceName) {
        this.yxProvinceCode = yxProvinceCode;
        this.lunzProvinceCode = lunzProvinceCode;
        this.provinceName = provinceName;
    }

    /**
     * 通过易鑫code获取中瑞code
     * @param yxProvinceCode
     * @return
     */
    public static ProvinceMappingEnum getEnumByYxCode(String yxProvinceCode){
        ProvinceMappingEnum[] values = ProvinceMappingEnum.values();
        for (ProvinceMappingEnum value : values) {
            if (Objects.equals(value.yxProvinceCode,yxProvinceCode)){
                return value;
            }
        }
        return null;
    }

    /**
     * 通过中瑞code获取易鑫code
     * @param lunzProvinceCode
     * @return
     */
    public static ProvinceMappingEnum getEnumByLunzCode(String lunzProvinceCode){
        ProvinceMappingEnum[] values = ProvinceMappingEnum.values();
        for (ProvinceMappingEnum value : values) {
            if (Objects.equals(value.lunzProvinceCode,lunzProvinceCode)){
                return value;
            }
        }
        return null;
    }
}
